//
//  STFDRandomImageProvider.m
//  Pods-stoneobs_fakedata_Example
//
//  Created by imac on 2019/7/3.
//

#import "STFDRandomImageProvider.h"
#define goodBannerCount 30  //商品图片数量
#define sceneBannerCount 35 //风景图片数量
#define roundCount 17       //圆图片图片数量
#define itemCount 31        //头像图片数量
#define normallCount  45        //一般cell中图片数量
#define liveGirlCount  60        //美女 图片 总数

@implementation STFDRandomImageProvider
+ (UIImage *)imageNamed:(NSString *)name{

    NSBundle *currentBundle = [NSBundle bundleForClass:[self class]];
    NSString *imagefailName = [NSString stringWithFormat:@"%@.jpg",name];
    // 获取图片的路径,其中BMCH5WebView是组件名
    NSString *imagePath = [currentBundle pathForResource:imagefailName ofType:nil inDirectory:[NSString stringWithFormat:@"%@.bundle",@"stoneobs_fakedata"]];
    // 获取图片
    UIImage * dealImage =  [UIImage imageWithContentsOfFile:imagePath];
    return dealImage;
}
//随机一张banner 风景
+ (UIImage*)random_banner_scene_image{
    NSInteger randIntger = arc4random()%(sceneBannerCount-1)   + 1;
    NSString * imageName = [NSString stringWithFormat:@"%@%@",@"banner_scene_",@(randIntger)];
    return [self imageNamed:imageName];
}
//随机一张banner 电商
+ (UIImage*)random_banner_shop_image{
    NSInteger randIntger = arc4random()%(goodBannerCount-1)   + 1;
    NSString * imageName = [NSString stringWithFormat:@"%@%@",@"banner_shop_",@(randIntger)];
    return [self imageNamed:imageName];
}
//随机一张1:1 头像
+ (UIImage*)random_item_image{
    NSInteger randIntger = arc4random()%(itemCount-1)   + 1;
    NSString * imageName = [NSString stringWithFormat:@"%@%@",@"item_",@(randIntger)];
    return [self imageNamed:imageName];
}
//随机一张500 × 375 头像
+ (UIImage*)random_normal_image{
    NSInteger randIntger = arc4random()%(normallCount-1)   + 1;
    NSString * imageName = [NSString stringWithFormat:@"%@%@",@"normal_",@(randIntger)];
    return [self imageNamed:imageName];
}
//随机一张1:1 圆头像
+ (UIImage*)random_round_image{
    NSInteger randIntger = arc4random()%(roundCount-1)   + 1;
    NSString * imageName = [NSString stringWithFormat:@"%@%@",@"round_",@(randIntger)];
    return [self imageNamed:imageName];
}
//随机一张直播美女图片
+ (UIImage*)random_livegirl_image{
    NSInteger randIntger = arc4random()%(liveGirlCount-1)   + 1;
    NSString * imageName = [NSString stringWithFormat:@"%@%@",@"live_girl_icon_",@(randIntger)];
    return [self imageNamed:imageName];
}


//随机count张banner 风景 count=0 将在最大数量max图片中随机出1~max图片
+ (NSArray<UIImage*>*)random_banner_scene_imageWithCount:(NSInteger)count{
    NSMutableArray * imageArray = NSMutableArray.new;
    NSInteger dealCount = count;
    if (count == 0) {
        NSInteger randIntger = arc4random()%(sceneBannerCount-1)   + 1;
        dealCount = randIntger;
    }
    for (NSInteger i = 0; i < dealCount; i ++) {
        UIImage * image = [self random_banner_scene_image];
        [imageArray addObject:image];
    }
    return imageArray;
}

//随机count张banner 电商 count=0 将在最大数量max图片中随机出1~max图片
+ (NSArray<UIImage*>*)random_banner_shop_imageWithCount:(NSInteger)count{
    NSMutableArray * imageArray = NSMutableArray.new;
    NSInteger dealCount = count;
    if (count == 0) {
        NSInteger randIntger = arc4random()%(goodBannerCount-1)   + 1;
        dealCount = randIntger;
    }
    for (NSInteger i = 0; i < dealCount; i ++) {
        UIImage * image = [self random_banner_shop_image];
        [imageArray addObject:image];
    }
    return imageArray;
}

//随机count张1:1 头像 count=0 将在最大数量max图片中随机出1~max图片
+ (NSArray<UIImage*>*)random_item_imageWithCount:(NSInteger)count{
    NSMutableArray * imageArray = NSMutableArray.new;
    NSInteger dealCount = count;
    if (count == 0) {
        NSInteger randIntger = arc4random()%(itemCount-1)   + 1;
        dealCount = randIntger;
    }
    for (NSInteger i = 0; i < dealCount; i ++) {
        UIImage * image = [self random_item_image];
        [imageArray addObject:image];
    }
    return imageArray;
}

//随机count张500 × 375 头像 count=0 将在最大数量max图片中随机出1~max图片
+ (NSArray<UIImage*>*)random_normal_imageWithCount:(NSInteger)count{
    NSMutableArray * imageArray = NSMutableArray.new;
    NSInteger dealCount = count;
    if (count == 0) {
        NSInteger randIntger = arc4random()%(normallCount-1)   + 1;
        dealCount = randIntger;
    }
    for (NSInteger i = 0; i < dealCount; i ++) {
        UIImage * image = [self random_normal_image];
        [imageArray addObject:image];
    }
    return imageArray;
}

//随机count张1:1 圆头像 count=0 将在最大数量max图片中随机出1~max图片
+ (NSArray<UIImage*>*)random_round_imageWithCount:(NSInteger)count{
    NSMutableArray * imageArray = NSMutableArray.new;
    NSInteger dealCount = count;
    if (count == 0) {
        NSInteger randIntger = arc4random()%(roundCount-1)   + 1;
        dealCount = randIntger;
    }
    for (NSInteger i = 0; i < dealCount; i ++) {
        UIImage * image = [self random_round_image];
        [imageArray addObject:image];
    }
    return imageArray;
}
//随机count张直播美女图片 count=0 将在最大数量max图片中随机出1~max图片
+ (NSArray<UIImage*>*)random_livegirl_imageWithCount:(NSInteger)count{
    NSMutableArray * imageArray = NSMutableArray.new;
    NSInteger dealCount = count;
    if (count == 0) {
        NSInteger randIntger = arc4random()%(liveGirlCount-1)   + 1;
        dealCount = randIntger;
    }
    for (NSInteger i = 0; i < dealCount; i ++) {
        UIImage * image = [self random_livegirl_image];
        [imageArray addObject:image];
    }
    return imageArray;
}
@end
